package cn.oa.configure;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import cn.oa.configure.pojo.ViewController;
import cn.oa.configure.pojo.Views;
@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
	@Resource
	private Views views;

	@Override
	public void addViewControllers(ViewControllerRegistry registry) {
		if(views!=null && views.getViewControllers()!=null) {
			List<ViewController> Controllers = views.getViewControllers();
			for (ViewController viewController : Controllers) {
				registry.addViewController(viewController.getPath()).setViewName(viewController.getViewName());
			}
			
		}
	}
	
}
